package com.heima.admin.listener;

import com.alibaba.fastjson.JSON;
import com.heima.admin.service.IAdChannelService;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class DeleteChannelListener {
    @Autowired
    private IAdChannelService adChannelService;

    @KafkaListener(topics = "delete_channel")
    public void deleteChannel(ConsumerRecord<String,String> consumerRecord){
        String id = consumerRecord.value();
        System.out.println("admin监听到了id数据："+id);
        adChannelService.deleteChannel(id);
    }
}
